import tkinter as tk
from tkinter import BOTH, ttk

# CH32V103C8T6 外设分为如下配置项（实现部分）
# GPIO  ADC  TIM   WDOG  DAC   USART  I2C  SPI  

class GPIOTabFrame(ttk.Frame):
    def __init__(self, master: tk.Misc | None = ...) -> None:
        super().__init__(master)
        # 创建UI
        

class TimerTab(ttk.Frame):
    def __init__(self,master: tk.Misc | None = ...) -> None:
        super().__init__(master)

class ADCTab(ttk.Frame):
    def __init__(self,master: tk.Misc | None = ...) -> None:
        super().__init__(master)

class DACTab(ttk.Frame):
    def __init__(self,master: tk.Misc | None = ...) -> None:
        super().__init__(master)

class Configurer:
    def createGPIOTab(self,root:tk.Tk) -> ttk.Frame:
        Frame = GPIOTabFrame(root)
        return Frame

    def createTimerTab(self,root:tk.Tk) -> ttk.Frame:
        Frame = ttk.Frame(root,borderwidth=1)
        return Frame

    def createADCTab(self,root:tk.Tk) -> ttk.Frame:
        Frame = ttk.Frame(root,borderwidth=1)
        return Frame

    def createUSARTTab(self,root:tk.Tk) -> ttk.Frame:
        Frame = ttk.Frame(root,borderwidth=1)
        return Frame

    def createConfigWnd(self):
        window = tk.Tk()
        window.title("CH32V103C8T6配置")
        window.geometry("1500x900+20+10")

        notebook = ttk.Notebook(window)
        notebook.pack(fill=BOTH,expand=True)

        notebook.add(self.createGPIOTab(window),text="GPIO")
        notebook.add(self.createTimerTab(window),text="定时器")
        notebook.add(self.createADCTab(window),text="ADC")
        notebook.add(self.createUSARTTab(window),text="USART")

        window.mainloop()

    def config(self):
        # 创建配置窗口
        self.createConfigWnd()
        